<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">	
			<a class="mui-icon mui-icon-back mui-action-back mui-pull-left"></a>
			<h1 class="mui-title ">模拟考试</h1>
			
		</header>
		<div class="mui-content">
			<div class="mui-input-group" style="margin-top: 10px;">
				<ul class="mui-table-view mui-table-view-striped mui-table-view-condensed" v-for="item in data">
			        <!--<li class="mui-table-view-cell">
			            <div class="mui-table mui-navigate-right" v-on:click="openFile(item.Id)">
			                <div class="mui-table-cell mui-col-xs-3 " style="border: solid red 0px; " >
			                    <h5 class="mui-ellipsis" style="padding-top: 5px;"><label>96.5</label>分<h5>
			                </div>
			                <div class="mui-table-cell mui-col-xs-3 " style="border: solid red 0px; ">
			                    <h5 class="mui-ellipsis" style="padding-top: 5px;">40:20</h5>
			                </div>
			                <div class="mui-table-cell mui-col-xs-6 " style="border: solid red 0px; text-align: center; " >
			                    <h5 class="mui-ellipsis" style="padding-top: 5px;">2019-06-12 10:12</h5>
			                </div>
			            </div>
			        </li>-->
			        <li class="mui-table-view-cell">
			            <div class="mui-table">
			                <div class="mui-table-cell mui-col-xs-3 " style="border: solid red 0px; " >
			                    <h5 class="mui-ellipsis" style="padding-top: 5px;"><label v-html="item.ExamGrade">96.5</label>分<h5>
			                </div>
			                <div class="mui-table-cell mui-col-xs-3 " style="border: solid red 0px; ">
			                    <h5 class="mui-ellipsis" style="padding-top: 5px;" v-html="item.UsedTime">40:20</h5>
			                </div>
			                <div class="mui-table-cell mui-col-xs-6 " style="border: solid red 0px; text-align: center; " >
			                    <h5 class="mui-ellipsis" style="padding-top: 5px;" v-html="item.CloseTime">2019-06-12 10:12</h5>
			                </div>
			            </div>
			        </li>
			    </ul>
			</div>
			<div class="mui-row">&nbsp;</div>
			
			<div class="mui-bar mui-bar-tab" style="text-align: center;">
				<button type="button" class="mui-btn mui-btn-primary" v-on:click="openWindow()">开始考试</button>
			</div>
		</div>
		
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript" src="../js/vue.min.js" ></script>
		<script type="text/javascript" src="../js/app.js?v=20190613" ></script>
		<script type="text/javascript">
			mui.init()
			var vm = new Vue({
				el: '.mui-content',
				data: {
					rows:10,
					page:1,
					total:0,
					records:0,
					data: [] //列表信息流数据
				}
			});
			mui.plusReady(function(){
				/*加载数据*/
				loadData();
			});
			
			function loadData(){
				
				var setting = app.getSetting();
				var queryJson = {
					RefPersonId:"personId"
				};
				var ajaxUrl = setting.ServerUrl +"/api/PeopleExamRecord/GetPageVaildList?orderName=&orderType=&rows="+vm.rows+"&page="+vm.page+"&queryJson="+JSON.stringify(queryJson);
				console.log(ajaxUrl);
				plus.nativeUI.showWaiting("正在加载数据，请稍候...");
				mui.ajax(ajaxUrl,{
					dataType:'json',//服务器返回json格式数据
					type:'get',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；
					headers:{'Content-Type':'application/json'},	              
					success:function(result){
						plus.nativeUI.closeWaiting();
						//服务器返回响应，根据响应结果，分析是否登录成功；
						console.log(JSON.stringify(result));
						if(result.ResultType != 0){
							mui.toast(result.Content);
							return;
						}
						var appendData = JSON.parse(result.AppendData);
						vm.page = appendData.page;
						vm.total = appendData.total;
						vm.records = appendData.records;
						vm.data = appendData.rows;
					},
					error:function(xhr,type,errorThrown){
						plus.nativeUI.closeWaiting();
						//异常处理；
						console.log(type);
						mui.toast("加载数据异常！");
					}
				});
			}
			
			function appendData(){
				var setting = app.getSetting();
				var queryJson = {
					RefPersonId:"personId"
				};
				var ajaxUrl = setting.ServerUrl +"/api/PeopleExamRecord/GetPageVaildList?orderName=&orderType=&rows="+vm.rows+"&page="+vm.page+"&queryJson="+JSON.stringify(queryJson);
				console.log(ajaxUrl);
				plus.nativeUI.showWaiting("正在加载数据，请稍候...");
				mui.ajax(ajaxUrl,{
					dataType:'json',//服务器返回json格式数据
					type:'get',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；
					headers:{'Content-Type':'application/json'},	              
					success:function(result){
						plus.nativeUI.closeWaiting();
						//服务器返回响应，根据响应结果，分析是否登录成功；
						console.log(JSON.stringify(result));
						if(result.ResultType != 0){
							mui.toast(result.Content);
							return;
						}
						var appendData = JSON.parse(result.AppendData);
						vm.page = appendData.page;
						vm.total = appendData.total;
						vm.records = appendData.records;
						vm.data.push(appendData.rows);
					},
					error:function(xhr,type,errorThrown){
						plus.nativeUI.closeWaiting();
						//异常处理；
						console.log(type);
						mui.toast("加载数据异常！");
					}
				});
			}
			
			function openWindow() {
				/*加载数据*/
				var setting = app.getSetting();
				var ajaxUrl = setting.ServerUrl +"/api/PeopleExamRecord/GetNewEntity?personId=personId";
				console.log(ajaxUrl);
				plus.nativeUI.showWaiting("正在加载数据，请稍候...");
				mui.ajax(ajaxUrl,{
					dataType:'json',//服务器返回json格式数据
					type:'get',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；
					headers:{'Content-Type':'application/json'},	              
					success:function(result){
						plus.nativeUI.closeWaiting();
						//服务器返回响应，根据响应结果，分析是否登录成功；
						console.log(JSON.stringify(result));
						if(result.ResultType != 0){
							mui.toast(result.Content);
							return;
						}
						/*临时保存数据*/
						var appendData = JSON.parse(result.AppendData);
						app.initSimulate(appendData);
						
						mui.openWindow({
							id:"simulateExam",
							url:"simulateExam.html?v=" + parseInt(Math.random()*1000000000) ,
							show:{aniShow: 'pop-in'},
							extras: {},
							waiting: {autoShow: false, /*自动显示等待框，默认为true*/}
						});
					},
					error:function(xhr,type,errorThrown){
						plus.nativeUI.closeWaiting();
						//异常处理；
						console.log(type);
						mui.toast("加载数据异常！");
					}
				});
				
			}
		</script>
	</body>

</html>